<template>
  <el-select
    @change="onChange"
    v-model="value"
    :style="styleCss"
    v-bind="{ ...props }"
  >
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    />
  </el-select>
</template>

<script setup lang="ts">
import type { SelectType } from "./interface/";
interface IEmit {
  (event: "update:modelValue", n: string): void;
  (event: "onChange", n: string): void;
}

defineOptions({ name: "WSelect" });

const props = defineProps<SelectType.Props>();
let emit = defineEmits<IEmit>();

const value = useVModel(props, "modelValue");

const onChange = (val: string) => {
  emit("onChange", val);
};
</script>

<style scoped></style>
